﻿@using DeliveryPlus.Web.Classes.Ext
@using DeliveryPlus.Web.Classes.Utils
@model System.Collections.Generic.List<DeliveryPlus.Web.DAL.Entities.Article>

@{
    ViewBag.Title = "Все новости";
    Layout = "../Shared/Layout.cshtml";
    int total = ViewBag.total;
    int page = ViewBag.page;
    var pages = MathUtils.PagesCount(total, 10);
}

<div class="page" id="page-articles">
    <div class="title">Все новости</div>
    <div id="articles-list">
        @foreach (var article in Model)
        {
            <div class="news-pub">
                <div class="red news-date">
                    @article.PublicationDate.FormatDate() г.
                </div>
                <div class="news-title" style="font-size: 1.2em">
                    <a href="/article/@article.Id">@article.Title</a>
                </div>
                <div style="margin-top: 7px; line-height: 1.5;">
                    @article.Annotation
                </div>
            </div>
        }
    </div>
    @if (pages > 1)
    {
        <div id="paginator">
            @for (var i = 1; i <= pages; i++)
            {
                <a href="/Articles?page=@(i-1)" @(i == (page+1) ? "class=active":"")>@(i)</a>
            }
        </div>
    }
</div>
